﻿using System.Data;
using System.Data.Entity.Infrastructure;
using Quba.DataAccess.Repositories.Abstract;
using Quba.Entities.Database.Question;

namespace Quba.DataAccess.Repositories.Concrete
{
    public class QuestionPaperRepository : QubaBaseRepositoty<QuestionPaper>, IQuestionPaperRepository
    {
        private QuestionPaper _result;

        #region Get
        public override QuestionPaper Get(int questionTypeId)
        {
            return _GetQubaContext().QuestionPapers.Find(questionTypeId);
        }
        #endregion Get

        #region Update
        public override QuestionPaper Update(QuestionPaper questionPaper)
        {
            _result = _GetQubaContext().QuestionPapers.Add(questionPaper);
            DbEntityEntry entry = _GetQubaContext().Entry(questionPaper);
            entry.State = EntityState.Modified;

            _GetQubaContext().SaveChanges();
            return _result;
        }
        #endregion Update
    }
}